package br.com.felix.fwt.ui;

import java.io.PrintWriter;
import java.io.Serializable;

import org.apache.log4j.Logger;

import br.com.felix.fwt.log.LoggerFactory;
import br.com.felix.fwt.ui.exception.ComponentRenderException;

public class TextArea extends BaseComponent implements Serializable {

	private static final long serialVersionUID = -6402589045048497816L;

	private static Logger logger = LoggerFactory.getLogger(TextArea.class);
	
	public int rows = 5;
	public int cols = 20;
	
	{
		this.cssClass = "fwttextarea";
		setValue("");
	}
	
	
	@Override
	public void write(PrintWriter out) throws ComponentRenderException {
		out.write("<textarea name=\"");
		out.write(getName());
		
		out.write("\" rows=\"");
		out.write(String.valueOf(rows));
		out.write("\" cols=\"");
		out.write(String.valueOf(cols));
		out.write("\" ");
		if(style!=null){
			out.write(style);
		}
		out.write(" >");
		out.write(getValue());
		out.write("</textarea>");
	}


	/**
	 * @see BaseComponent#isInputControl()
	 * */
    @Override
    public boolean isInputControl() {
        return true;
    }

}
